FROM node:20
RUN echo "backup the default source"
RUN mkdir -p /apt_repo
RUN mv /etc/apt/sources.list.d/*  /apt_repo/
RUN echo "Build a new source"
ADD ./debian.sources /etc/apt/sources.list.d/debian.sources

RUN apt-get -qq update && \
    apt-get install -y \
    gcc \
    python3 \
    g++ \
    fp-compiler \
    openjdk-11-jdk \
    php8.2 \
    rustc \
    haskell-platform \
    libjavascriptcoregtk-4.0-bin \
    golang \
    ruby \
    mono-runtime \
    mono-mcs

ADD ./entrypoint.sh /root/entrypoint.sh
ADD ./judge.yaml /root/judge.yaml
RUN chmod +x /root/entrypoint.sh

RUN yarn global add pm2 @hydrooj/hydrojudge
ADD ./go-judge_1.8.0_linux_amd64 /usr/bin/sandbox
RUN chmod +x /usr/bin/sandbox
ENTRYPOINT /root/entrypoint.sh
